﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Medianamik.Core;
using Medianamik.Core.Querying;
using Medianamik.Service.ActiveDirectory.Type;
using Medianamik.UI;
using Telerik.Web.UI;

namespace Medianamik.Service.ActiveDirectory
{
    public partial class GroupAssociationList : BaseModuleListPage
    {
        protected void Page_Load(object sender, EventArgs e)
        {

        }

        protected override string ReturnUrl
        {
            get { return "/medianamik/securitymanagement/groupassociationlist.aspx"; }
        }

        protected override void GridNeedDataSource(object source, GridNeedDataSourceEventArgs e)
        {
            Grid.DataSource = new Query()
                .Where(q => q.ParentID, Comparison.Equal, MedianamikModules.ActiveDirectoryManagement)
                .Execute().OrderBy(q => q.DefaultInstance.Properties["MedianamikGroup"].Value);
        }

        protected override RadGrid Grid
        {
            get { return GroupAssociations; }
        }

        protected override GridOptions GridOptions
        {
            get
            {
                return GridOptions.None;
            }
        }

        protected override GridActionOptions GridActionOptions
        {
            get
            {
                return GridActionOptions.Edit | GridActionOptions.Delete;
            }
        }

        protected override UpdatePanel GridUpdatePanel
        {
            get { return mainUpdatePanel; }
        }

        protected override string ManagementURL
        {
            get { return "GroupAssociationManagement.aspx"; }
        }
    }
}